package com.atguigu.springcloud.feign;

import com.atguigu.springcloud.api.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @author : wenchao.long
 * @date : Created in 2020/12/17 16:08 周四
 * @description :
 */
@FeignClient(name = "CLOUD-PROVIDER-HYSTRIX-PAYMENT", fallback = PaymentHystrixClientImpl.class)
public interface IPaymentHystrixClient {

    String API = "/client";
    String INFO = API + "/payment/hystrix/ok/{id}";
    String TIMEOUT = API + "/payment/hystrix/timeout/{id}";

    /**
     * 测试正常
     *
     * @param id id
     * @return String
     */
    @GetMapping(INFO)
    Result<String> paymentInfo(@PathVariable("id") Integer id);

    /**
     * 测试超时
     *
     * @param id id
     * @return String
     */
    @GetMapping(TIMEOUT)
    Result<String> paymentInfoTimeout(@PathVariable("id") Integer id);
}
